<?php

// $Id: ci_image_form_ajax_ctrl.class.php 1606 2009-03-03 20:06:36Z ogrebg $


require_once($WSC->get_site_inc_dir().'modules/admin_panel/site_admin_ajax_form_ctrl_with_object_ua.class.php');
require_once($WSC->get_site_inc_dir().'modules/tangra_cms/forms/_ci/ci_image/ci_image_form_ctrl.class.php');


class CI_Image_Form_Ajax_Ctrl extends Site_Admin_Ajax_Form_Ctrl_With_Object_UA {
	protected function init_transit_vars() {
		$this->add_transit_var('vpage');
		$this->add_transit_var('category');
		$this->add_transit_var('ret');
		$this->add_transit_var('ci');
	}


	protected function on_good_submit() {
		$redir = $this->create_redirect_composer('admin/modules/tangra_cms/ci/ci_images.php', array('ci' => $this->get_transit_var('ci')));
		$object = $this->form_ctrl->get_object();

		$location = $redir->get_target_address($this->get__context());

		$ret = array('command' => Ajax_Ctrl::COMMAND_REDIRECT, 'command_value' => $location);

		return $ret;
	}


	protected function on_bad_submit() {
		return true;
	}


	protected function create_form_ctrl() {
		$tvm = $this->get_tvm();
		$dbc = $this->get_dbc();

		$ret = new ci_image_Form_Ctrl('ci_image', $tvm, $dbc);

		return $ret;
	}
}
